<template>
	<view class="list" >
		<template v-if="collect">
			<view  class="img">
				<image v-if="userLandList.photosList[0]" @tap="ViewImage" :src="userLandList.photosList[0]?userLandList.photosList[0].land_photo:''"></image>
				<image class="noimg" v-else src="../../static/img404.png"></image>
			</view>
			<view class="listRight">
				<view class="title">{{userLandList.introduce}}</view>
				<view class="history"><text>{{userLandList.area}}亩|</text><text>{{userLandList.term}}|</text><text>{{userLandList.type}}</text></view>
				<view class="address"><image src="../../static/userLand/dingwei.png"></image><text>{{userLandList.province}}-</text><text>{{userLandList.county}}</text></view>
				<view class="type"><text class="landType">{{userLandList.circulation}}：</text><text class="price">{{userLandList.price}}万元</text></view>
				<view class="but" v-if="collect">
					<view><text class="hint" >未发布</text></view>
					<view class="butList"><text @tap="landEditor">编辑</text>|<text @tap="collectDelete(userLandList.id)">删除</text></view>
				</view>
			</view>
		</template>
		<template v-else-if="sell">
			<view  class="img">
				<image v-if="userLandList.issuePhotoList[0]" @tap="ViewImage" :src="userLandList.issuePhotoList[0]?userLandList.issuePhotoList[0].land_photo:''"></image>
				<image class="noimg" v-else src="../../static/img404.png"></image>
			</view>
			<view class="listRight">
				<view class="title">{{userLandList.introduce}}</view>
				<view class="history"><text>{{userLandList.area}}亩|</text><text>{{userLandList.term}}|</text><text>{{userLandList.type}}</text></view>
				<view class="address"><image src="../../static/userLand/dingwei.png"></image><text>{{userLandList.province}}-</text><text>{{userLandList.county}}</text></view>
				<view class="type"><text class="landType">{{userLandList.circulation}}：</text><text class="price">{{userLandList.price}}万元</text></view>
				<view class="but" v-if="sell">
					<view><text class="hint" >发布中</text></view>
					<!-- <view class="butList"><text @tap="sellPush">上架</text>|<text @tap="sellRecycle">下架</text>|<text>编辑</text></view> -->
				</view>
			</view>
		</template>
		<template v-else-if="dealt">
			<view  class="img">
				<image v-if="userLandList.transactionPhotoList[0]" @tap="ViewImage" :src="userLandList.transactionPhotoList[0]?userLandList.transactionPhotoList[0].land_photo:''"></image>
				<image class="noimg" v-else src="../../static/img404.png"></image>
			</view>
			<view class="listRight">
				<view class="title">{{userLandList.introduce}}</view>
				<view class="history"><text>{{userLandList.area}}亩|</text><text>{{userLandList.term}}|</text><text>{{userLandList.type}}</text></view>
				<view class="address"><image src="../../static/userLand/dingwei.png"></image><text>{{userLandList.province}}-</text><text>{{userLandList.county}}</text></view>
				<view class="type"><text class="landType">{{userLandList.circulation}}：</text><text class="price">{{userLandList.price}}万元</text></view>
				<view class="but" v-if="dealt">
					<view><text class="hint" >交易完成</text></view>
					<view class="butList"><text @tap="dealtPush(userLandList.id)">上架</text></view>
				</view>
			</view>
		</template>
		
	</view>
</template>

<script>
	export default {
		props:{
			userLandList:{
				type:Object
			},
			// collect代表采集
			collect:{
				type:Boolean,
				default:false
			},
			// sell出售
			sell:{
				type:Boolean,
				default:false
			},
			// dealt已交易
			dealt:{
				type:Boolean,
				default:false
			},
			
		},
		
		data() {
			return {
				num:3,
				noImg:'../../static/img404.png'
			};
		},
		methods:{
			//前往编辑
			landEditor(){
				this.$emit('Editor');
			},
			//预览图片
			ViewImage(e) {
				console.log(e)
				var arr = [];
				arr.push(this.userLandList.photosList[0].land_photo)
				uni.previewImage({
					urls:arr
				});
			},
			//重新上架
			dealtPush(id){
				uni.showModal({
					title:"提示",
					content:"确定重新上架该土地吗",
					success: (res) => {
						if(res.confirm){
							this.$emit('dealtPush',id)
						}
					}
				})
			},
			//土地下架
			sellRecycle(){
				uni.showModal({
					title:"提示",
					content:"确定将该土地下架吗"
				})
			},
			//土地上架
			sellPush(){
				uni.showModal({
					title:"提示",
					content:"确定将该土地上架吗"
				})
			},
			//发布土地
			collectPush(){
				uni.showModal({
					title:"提示",
					content:"确定将该土地发布吗"
				})
			},
			//土地删除选择
			collectDelete(id){
				uni.showModal({
					title:"提示",
					content:"确定将该土地删除吗?",
					success: (res) => {
						if(res.confirm){
							// this.deleteLand(id);
							this.$emit('deleteLand',id)
						}
					}
				})
			},
			// //删除土地
			// deleteLand(id){
			// 	console.log(id);
			// }
			
		}
	}
</script>

<style lang="less">
	@import  "../../common/global.less";
	.noimg{
		width: 90% !important;
		transform: scale(0.8);
	}
	.but{
		// background-color: #007AFF;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		.butList{
			color: #007AFF;
			>text{
				padding: 0rpx 10rpx;
				}
		}
	}
.hint{
		font-size: 30rpx;
		padding: 5rpx;
		margin-left: 10rpx;
		text-align: center;
		letter-spacing: 4rpx;
		color:#3BB985 ;
		border: 2rpx solid #3BB985;
		border-radius: 10rpx;
	}
	.type{
		padding-left: 5rpx;
		font-size: 32rpx;
		.landType{ color:@fontcolorthree}
		.price{ color:red;}
	}
	.address{
		margin: 10rpx 0rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		>image{ height: 40rpx; width: 42rpx;}
		>text{
			padding-left: 5rpx;
			font-size: @timeSize;
			color: @fontcolorthree;
		}
	}
	.history{
		padding-left: 10rpx;
		font-size: @timeSize;
		color: @fontcolorthree;
		margin: 10rpx 0rpx;
	}
	.title{
		.hidden;
		padding:0rpx 5rpx 5rpx 10rpx;
		font-size:35rpx;
		
	}
	.list{
		line-height: 300rpx;
		border-bottom: 1rpx solid #F5F5F5;
		padding: 15rpx;
		display: flex;
		flex-direction: row;
	}
	.img{
		width: 40%;
		height: 300rpx;
		display: flex;
		align-items: center;
		>image{ 
			height: 90%;
			width: 100%;
		}
		
		}
	.listRight{ 
		width:60%;
		 height: 100%;
		 }
</style>
